<?php

/**
 * This is the model class for table "nunggulama_location_posting".
 *
 * The followings are the available columns in table 'nunggulama_location_posting':
 * @property integer $idnunggulama_location_posting
 * @property string $Type
 * @property string $Route
 * @property string $User_Update
 * @property string $username
 * @property string $posting_time
 * @property double $latitude
 * @property double $longitude
 */
class LocationPosting extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return LocationPosting the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'nunggulama_location_posting';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('latitude, longitude', 'numerical'),
			array('Type', 'length', 'max'=>45),
			array('Route, username', 'length', 'max'=>100),
			array('User_Update', 'length', 'max'=>140),
			array('posting_time', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('idnunggulama_location_posting, Type, Route, User_Update, username, posting_time, latitude, longitude', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'idnunggulama_location_posting' => 'Idnunggulama Location Posting',
			'Type' => 'Type',
			'Route' => 'Route',
			'User_Update' => 'User Update',
			'username' => 'Username',
			'posting_time' => 'Posting Time',
			'latitude' => 'Latitude',
			'longitude' => 'Longitude',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('idnunggulama_location_posting',$this->idnunggulama_location_posting);
		$criteria->compare('Type',$this->Type,true);
		$criteria->compare('Route',$this->Route,true);
		$criteria->compare('User_Update',$this->User_Update,true);
		$criteria->compare('username',$this->username,true);
		$criteria->compare('posting_time',$this->posting_time,true);
		$criteria->compare('latitude',$this->latitude);
		$criteria->compare('longitude',$this->longitude);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}